import { Vue, Component } from 'vue-property-decorator'

@Component
export default class TipsMinxin extends Vue {
  public showDangerTips(error: any = {}) {
    if (this.$refs?.globalTips?.showTips) {
      if (error?.data?.code === 401) {
        this.$refs.globalTips.showTips({
          type: 'danger',
          msg: error?.data?.message ?? '登录超时, 请重新进入!'
        })
        return
      }
      this.$refs.globalTips?.showTips({
        type: 'danger',
        msg: error?.msg ?? error?.data?.msg ?? error?.data?.message ?? undefined
      })
    } else {
      console.error('showDangerTips =>', error)
    }
  }

  $refs!: {
    globalTips: globalTipsElement
    uTabs: HTMLFormElement
    list: HTMLFormElement
    page: HTMLFormElement
    uForm: HTMLFormElement
    udropDownView: HTMLFormElement
  }
}
